<template>
    <div>
        <div class="kang">{{kangmu}}</div>
        <ul>
            <li 
                v-for="item in message"
                :key="item.id"
            >
                <span>姓名：{{item.name}}</span>
                <span>身份证号：{{item.name}}</span>
            </li>
        </ul>
        <button @click="gotoHome">去到主页</button>
    </div>
</template>

<script>
export default {
    name: 'Index',
    data() {
        return {
            kangmu: 'mumu',
            message: []
        }
    },
    mounted() {
        this.getData();
    },
    methods: {
        gotoHome() {
            this.$router.push({
                path: 'home'
            });
        },
        getData() {
            this.axios.get('./../public/home.json')
            .then((response) => {
                // this.message = res;
                console.log(response);
            }).catch((error) => {
                // console.log(error);
            })
        }
    }
}
</script>

<style lang="less">
.kang {
    color: #f00;
    width: 200px;
    height: 200px;
    border: 1px solid pink;
}
</style>